﻿<%@ Page Language="C#"  %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data.SqlClient" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
       

   
   
    <!-- Plugin stylesheets -->
  
    <link href="plugins/forms/uniform/uniform.default.css" type="text/css" rel="stylesheet" />        
    <link href="plugins/tables/dataTables/jquery.dataTables.css" type="text/css" rel="stylesheet" />
    
    <!-- Main stylesheets -->
   
<style>

    .btn_edit
    {
        text-decoration:none;
        padding:2px 10px;
        color:#202020;
        border:1px solid #ccc;
        background-image:url("img/edit.png");
        background-repeat:no-repeat;
        background-position:center center;
    }
     .btn_view
    {
        text-decoration:none;
        padding:2px 10px;
        color:#202020;
        border:1px solid #ccc;
        background-image:url("img/edit.png");
        background-repeat:no-repeat;
        background-position:center center;
    }
   .frm_row
   {
       width:95%;
       float:left;
       
   }
   .frm_row label
   {
       float:left;
       width:40%;
       margin-right:20px;
   }
   .frm_row input[type="text"],select
   {
       float:left;
       width:50%;
   }
</style>

        <title></title>
</head>
<body>
    <input id="Button1" type="button" value="Print"/>
   
    <%  
      
        SqlConnection con = null;
        con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        con.Open();

        SqlCommand hmd = new SqlCommand("SELECT * FROM property_buy", con);
       
        SqlDataReader hr = hmd.ExecuteReader();

        Response.Write("<div class=\"content noPad clearfix\">");
        Response.Write(" <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"responsive dynamicTable display table table-bordered\" id=\"mytable\"  >");
        Response.Write(" <thead>  <tr><th >CLient ID</th> <th>Agent</th><th>Client Type</th><th>Property type</th> <th>Full Name</th><th>Phone</th><th>From Room</th>  <th>To Room.</th></th> <th>Property size</th><th>From Budget</th> </th><th>Neighbourhood</th><th>Elevator</th><th>Parking</th><th>balcony</th><th>Comments</th> <th>Print</th> </tr></thead>");



        Response.Write("<tbody>");

        while (hr.Read())
        {
            string comment;
            comment = hr[76].ToString();

            

            //  Response.Write("<td class=\"center tr_select \"><input name=\"checkbox\" type=\"checkbox\" value=\"\"></td><td>" + hr[1].ToString() + "</td><td>" + hr[2].ToString() + "</td><td>" + hr[3].ToString() + "</td><td>" + hr[4].ToString() + "</td><td><a href=\"#\" class=\"btn_attch\" title=\"View Attachment\"></a></td><td><a href=\"#\" class=\"btn_view\" title=\"View\"></a><a href=\"#\" class=\"btn_reply\" title=\"Reply\"></a><a href=\"#\" class=\"btn_del\" title=\"Delete\"></a></td></tr>");

            Response.Write("<tr> <td>" + hr[1].ToString() + "</td> <td>" + hr[5].ToString() + "</td><td>" + hr[3].ToString() + "</td><td>" + hr[6].ToString() + " </td><td>" + hr[7].ToString() + "  " + hr[8].ToString() + " </td><td>" + hr[11].ToString() + "</td> <td>" + hr[23].ToString() + "</td>  <td>" + hr[43].ToString() + " " + hr[44].ToString() + "</td> <td>" + hr[60].ToString() + " " + hr[61].ToString() + "</td> <td>" + hr[15].ToString() + "</td><td>" + hr[14].ToString() + "</td><td>" + hr[39].ToString() + "</td><td>" + hr[37].ToString() + "</td><td>" + hr[45].ToString() + "</td> <td>" + comment + "</td><td><input type=\"checkbox\" name=\"tuesday[]\" value=\"Bike\" class=\"print\" id=\"test\"/></td></tr>");
        }
     
      Response.Write("</tbody>");
      Response.Write(" </table>");
      Response.Write(" </div>");
     hr.Close();
      con.Close(); %>
      

 <!--your content end-->
    
    </div> <!--toPopup end-->
  


  <div id="table" style="visibility:hidden;">
  
  
  </div>


</body>
</html>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>

<script type="text/javascript" src="js/popup.js"></script>
   
		<script type="text/javascript" language="javascript" src="js/datatable/jquery.dataTables.js"></script>
		  <script type="text/javascript" charset="utf-8">
		      $(document).ready(function () {
		          oTable = $('#dtable').dataTable({
		              "bJQueryUI": true,
		              "sPaginationType": "full_numbers"
		          });
		      });


		</script>
    
       <%-- <script>
            $(document).ready(function () {
                $('#dtable').dataTable({
                    "sDom": 'T<"clear">lfrtip<"clear spacer">T'
                });
            });</script>--%>
    <%--    <script type="text/javascript" charset="utf-8">
            $(document).ready(function () {
                oTable = $('#dtable').dataTable({
                    "bJQueryUI": true,
                    "sPaginationType": "full_numbers"
                });
            });


		</script>--%>
    
        <%--<script>
            $(document).ready(function () {
                $('#dtable').dataTable({
                    "sDom": 'T<"clear">lfrtip<"clear spacer">T'
                });
            });</script>--%>
  <style>
                                  .btn_reply
    {
        text-decoration:none;
        padding:2px 10px;
        color:#202020;
        border:1px solid #ccc;
        background-image:url("img/reply.ico");
        background-repeat:no-repeat;
        background-position:center center;
    }
     .btn_attch
    {
        text-decoration:none;
        padding:2px 10px;
        color:#202020;
        border:1px solid #ccc;
        background-image:url("img/1393645982_103307.ico");
        background-repeat:no-repeat;
        background-position:center center;
    }
      .btn_del
    {
        text-decoration:none;
        padding:2px 10px;
        color:#202020;
        border:1px solid #ccc;
        background-image:url("img/del.ico");
        background-repeat:no-repeat;
        background-position:center center;
    }
    .btn_edit
    {
        text-decoration:none;
        padding:2px 10px;
        color:#202020;
        border:1px solid #ccc;
        background-image:url("img/edit.ico");
        background-repeat:no-repeat;
        background-position:center center;
    }
      .btn_view
    {
        text-decoration:none;
        padding:2px 10px;
        color:#202020;
        border:1px solid #ccc;
        background-image:url("img/view.ico");
        background-repeat:no-repeat;
        background-position:center center;
    }

    </style>
  <script type="text/javascript" charset="utf-8">
      $(document).ready(function () {
          $('#Button1').click(function () {
              var $td = $(this).closest('tr').children('td'),
            $name = $td.eq(0).text();

              // Save it!
              //    document.location = 'to-rentupdate.aspx?id=' + $name;



          });
      });
</script>




<script type="text/javascript">
    var data;
    $('#Button1').click(function () {
        $('#table').empty();
        $('table tr').filter(':has(:checkbox:checked)').each(function () {
            $tr = $(this);
            $td = $tr.find('td');

            $('#table').append("<tr><td>" + $td.eq(0).text() + "</td><td>" + $td.eq(1).text() + "</td><td>" + $td.eq(2).text() + "</td>" + "<td>" + $td.eq(3).text() + "</td>" + "<td>" + $td.eq(4).text() + "</td>" + "<td>" + $td.eq(5).text() + "</td>" + "<td>" + $td.eq(6).text() + "</td>" + "<td>" + $td.eq(7).text() + "</td>" + "<td>" + $td.eq(8).text() + "</td>" + "<td>" + $td.eq(9).text() + "</td>" + "<td>" + $td.eq(10).text() + "</td>" + "<td>" + $td.eq(11).text() + "</td>" + "<td>" + $td.eq(12).text() + "</td>" + "<td>" + $td.eq(13).text() + "</td>" + "<td>" + $td.eq(14).text() + "</td>" + "</tr>");


        });
        data = $('#table').html();
        PrintPanel1(data);

    });


    function PrintPanel1(data1) {


        var printWindow = window.open('', '', 'height=650,width=1400', "_blank");
        printWindow.document.write('<html style="margin: 0 auto; width:100%"><head><title></title>');

        printWindow.document.write('<link rel="stylesheet" href="http://www.global-assetsgroup.com/en/admin/CSS/table.css" type="text/css" media="all" />');
        printWindow.document.write('</head><body style="background:#fff; width:100%; margin:0">');
        printWindow.document.write('<div class=\"printContainer\">');
        printWindow.document.write('<div class=\"CSSTableGenerator\"> <table>');
      
        printWindow.document.write("<tr><th >CLient ID</th> <th>Agent</th><th>Client Type</th><th>Property type</th> <th>Full Name</th><th>Phone</th><th>From Room</th>  <th>To Room.</th></th> <th>Property size</th><th>From Budget</th> </th><th>Neighbourhood</th><th>Elevator</th><th>Parking</th><th>balcony</th><th>Comments</th>  </tr>");

        printWindow.document.write(data1);
        printWindow.document.write(" </table></div></div>");


        printWindow.document.write('</body></html>');
        printWindow.document.close();
        setTimeout(function () {
            printWindow.print();
        }, 500);
        return false;
    }

</script>










     <script type="text/javascript" charset="utf-8">
         $(document).ready(function () {
             $('.btn_edit').click(function () {
                 var $td = $(this).closest('tr').children('td'),
            $name = $td.eq(0).text();


                 // Save it!
                 document.location = 'to-rentupdate.aspx?id=' + $name;



             });
         });
</script>
 <script type="text/javascript" charset="utf-8">

     $(document).ready(function () {
         $('.btn_del').click(function () {
             var $td = $(this).closest('tr').children('td'),
            $name = $td.eq(0).text();


             // Save it!
             document.location = 'delete-rent.aspx?id=' + $name;



         });
     });
</script>
 <script type="text/javascript" charset="utf-8">
     $(document).ready(function () {
         $('.btn_view').click(function () {
             var $td = $(this).closest('tr').children('td'),
            $name = $td.eq(0).text();


             // Save it!
             document.location = 'view_for_rent.aspx?id=' + $name;



         });
     });
</script>

    <script type="text/javascript" src="plugins/forms/uniform/jquery.uniform.min.js"></script>
        
    <!-- Fix plugins -->
  
    <script type="text/javascript" src="js/datatable.js"></script><!-- Init plugins only for page -->
 <script>
     $('#dtable').dataTable({
         "bServerSide": true,
         "fnServerData": getRows,
         "bDestroy": true
     });

     </script>